package com.huage_01;

public class ConvertArray {
    public static void main(String[] args) {
        int[] arr1 = {19,28,37,46,50};
        //int[] arr1 = {19,28,46,50};
        convertArray(arr1);
        //打印输出数组每个元素
        for (int j : arr1) {
            System.out.println(j);
        }
    }
    //反转数组每个元素
    /*
       传参类型：int[]
       返回值：void
     */
    public static void convertArray(int[] arr){
        int temp;
        int arrHalf = arr.length/2;
        if(arr.length%2==0){
            arrHalf--;
        }
        for(int i=0;i<=arrHalf;i++){
            temp = arr[i];
            arr[i] = arr[arr.length-1-i];
            arr[arr.length-1-i] = temp;
        }
    }
}
